#
# Makefile to build BeatPhone
#
# You might need to tweak it depending on your toolchain version

CC	= 	arm-apple-darwin-cc
AS	=  	arm-apple-darwin-as

SRC_M	=	main.m					\
		ui/BeatPhone.m				\
		ui/SamplePushButton.m
SRC_C	=	audiocore/audiocore.c			\
		audiocore/eventstack.c			\
		audiocore/sampledb.c

OBJS_M	= 	$(SRC_M:.m=.o)
OBJS_C	= 	$(SRC_C:.c=.o)
CFLAGS	= -Wall -O3 -I. -Iui -Iaudiocore -Iarm11  -I/Users/mat/build-iphone/include \
	-I/Users/truphone/build/iphone/top/include/glib-2.0 \
	-I/Users/truphone/build/iphone/top/lib/glib-2.0/include
LDFLAGS = -lobjc -framework CoreFoundation -framework Foundation -framework UIKit \
	-framework LayerKit -framework CoreAudio -framework AudioToolbox \
	-framework CoreFoundation -framework Foundation \
	-L/Users/mat/build-iphone/lib -lsndfile -L/Users/truphone/build/iphone/top/lib -lglib-2.0 -lintl

BIN	= BeatPhone

all	: $(ENV) $(BIN)

$(ENV)	:
	export MACOSX_DEPLOYMENT_TARGET="10.5"

$(BIN)	: $(OBJS) $(OBJS_C) $(OBJS_M) asm
	MACOSX_DEPLOYMENT_TARGET="10.5" $(CC) $(LDFLAGS) $(CFLAGS) -o $(BIN) $(OBJS_C) $(OBJS_M) mutex.o

asm	:
	$(CC) -c -o mutex.o arm11/mutex.S


clean	:
	rm -f $(OBJS_C) $(OBJS_M) $(BIN) *~ \#* .\#* ui/*~ ui/\#* ui/.\#* audiocore/*~ audiocore/\#* audiocore/.\#*
